// HashTable.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>
#include <vector>
using namespace std;

#include "IsAnagram.h"
#include "ArrayIntersection.h"
#include "TwoSum.h"
#include "IsHappyNum.h"
#include "FourSumCount.h"

template<typename ElementType, typename allocatorType = allocator<ElementType>, //声明容器所需要的 元素类型 和 分配器类型
    template <typename ElementType, typename allocatorType>
        typename ContainerType  //声明 ContainerType 是由两个参数构成的模板
>
void PrintSequenceContainer(const ContainerType<ElementType, allocatorType>& container) {
    cout << "{ ";
    for (auto iter = container.begin(); iter != container.end(); iter++)
        cout << *iter << ", ";
    cout << " }" << endl;
}

int main()
{
    //有效的字母异位词
    string s = "abcdefg", t = "gfedcba", t1 = "abc";
    cout << IsAnagram(s, t) << " " << IsAnagram(s, t1) << endl;

    //两个数组的交集
    vector<int> nums1 = { 1, 2, 2, 1 }, nums2 = { 2, 2 };
    PrintSequenceContainer(ArrayIntersection(nums1, nums2));


    //两数之和
    vector<int> twoSum = { 3,2,4 };
    //{ 2,7,11,15 };

    int target = 6;
    //9;
    PrintSequenceContainer(TwoSum(twoSum, target));


    //快乐数
    cout << IsHappy(2) << endl; //不快乐
    cout << IsHappy(19) << endl;    //快乐

    //四数相加 II
    vector<int> fourSumCountNums1 = { 1, 2 }, fourSumCountNums2 = { -2, -1 }, fourSumCountNums3 = { -1, 2 }, fourSumCountNums4 = { 0, 2 };
    cout << FourSumCount(fourSumCountNums1, fourSumCountNums2, fourSumCountNums3, fourSumCountNums4) << endl;
}